package com.wework.api;

import io.restassured.builder.ResponseBuilder;
import io.restassured.filter.Filter;
import io.restassured.filter.FilterContext;
import io.restassured.response.Response;
import io.restassured.specification.FilterableRequestSpecification;
import io.restassured.specification.FilterableResponseSpecification;

public class TokenFilter implements Filter {

    @Override
    public Response filter(FilterableRequestSpecification frequestSpec, FilterableResponseSpecification responseSpec, FilterContext ctx) {
        frequestSpec.queryParam("access_token",TokenHelper.getAccessToken());
        Response responseOrigin=ctx.next(frequestSpec,responseSpec);
        Response responseAction=new ResponseBuilder().clone(responseOrigin).build();
        return responseAction;
    }
}
